﻿using Microsoft.Extensions.Hosting;
using System.Threading;
using System.Threading.Tasks;
using VisionCloud.Service.Sys;

namespace VisionCloud.Web.Service
{
    public class FileUploadQueueBackService : BackgroundService
    {
        private DataSynchronizationService _DataSynchronizationService { get; set; }

        public FileUploadQueueBackService(DataSynchronizationService ds)
        {
            _DataSynchronizationService = ds;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                // await _DataSynchronizationService.AddInFileUploadQueue("adf", "adf");
                //  await _DataSynchronizationService.OutFileUploadQueue("adf");
                await _DataSynchronizationService.ClearTimeOutFileUploadQueue();
                await Task.Delay(_DataSynchronizationService.ClearUploadQueueTime);
            }
        }
    }
}